<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>7倍数、带7数</title>
</head>
<body>
    <script>

        /* for(var num=1; num<100; num++){

            // 被7整除、除10取整、除10余7
            if((num%7) == 0 || parseInt(num/10)==7 ||  (num%10)==7  ){
                document.write(num+"&nbsp;&nbsp;");
            }
        } */

        var num = 1;
        
        while(num<=100){

            // 符合进入if后自增，不符合直接自增
            if((num%7) == 0 || parseInt(num/10)==7 ||  (num%10)==7  ){
                document.write(num+'&nbsp');
            }
            // 注意自增位置
            num++;
        }

        // 修改备注：自增写在if里，当num不符合时就会一直执行空循环
    </script>
</body>
</html>